﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/BBSite.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    论坛
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="HotCards">
        <%Html.RenderAction("QueryAllHotCard", "BBS"); %>
    </div>
    <hr />
    <hr />
    <div id="Cards">
        <%Html.RenderAction("QueryAllInitCard", "BBS", new { page = 1 }); %>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FootContent" runat="server">

    <script type="text/javascript">
        function InitCard() {
            var text = CKEDITOR.tools.htmlEncode(editor.getData());
            var title = $("#card_title").val();
            if (text == "") {
                alert("内容不能为空");
                return false;
            }
            if (title == "") {
                alert("标题不能为空");
                return false;
            }

            $.ajax({
                type: "POST",
                url: "/BBS/IniteCard",
                data: { "text": text, "title": title }
            });
        }
    </script>

    <div id="initCard">
        <span>标题:</span>
        <%=Html.TextBox("card_title")%>
        <%Html.RenderPartial("Fckeditor"); %>
        <input type="button" onclick="InitCard()" value="发帖" />
    </div>
</asp:Content>
